package com.wang.spring.c;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class B implements InitializingBean{
    @Resource
    private A a;

    public int i = 0;
    public B() {
        System.out.println("b");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println(a.i);
        this.i = 1;
        System.out.println(this.i);
    }
}
